/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package server.logic;

import com.cse.p2p.common.CommonSettings;


/**
 *
 * @author TuyetNgan
 */
public class ServerLogicImplement {

    public static int choosePiecesSize(){
        // default 256KB
        return CommonSettings.DEFAULT_PACKAGE_SIZE;
    }

    public static int getNumberOfPiece(long FILE_SIZE, int PIECE_SIZE){
        if(FILE_SIZE % PIECE_SIZE == 0)
            return (int) FILE_SIZE/PIECE_SIZE;
        else
            return ((int)FILE_SIZE/PIECE_SIZE)+1;
    }

    // TO DO : wait for LocalFile and Database
    public Boolean checkPieceInDatabase(String FILE_ID, String PIECE_ID){
        return true;
    }
    public Boolean checkPieceInLocalFile(String FILE_ID, String PIECE_ID){
        return true;
    }

//
//    /**
//     * @param args the command line arguments
//     */
//
//    public static void main(String[] args) {
//        // TODO code application logic here
//    }
}
